<?php
// nav active links
$homeCl = "";
$listingCl = "";
$listingAddCl = "";
$offerCl = "";
$eventCl = "";
$userCl = "";
$advSearchCl = "";
$url = $this->params['url']['url'];
if($url == "/")
{
    $homeCl = "active";    
}
if($url == "listings")
{
    $listingCl = "active";    
}
if($url == "listings/add")
{
    $listingAddCl = "active";    
}
if($url == "deals/deals/index/")
{
    $offerCl = "active";    
}
if($url == "events/events/index")
{
    $eventCl = "active";    
}
if($url == "users")
{
    $userCl = "active";    
}
if($url == "listings/advancedSearch")
{
    $advSearchCl = "active";    
}
?>
<div id="nav">
        <div class="container">
            <button type="button" data-toggle="collapse" data-target="#navbar-collapse-1" class="navbar-toggle">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>

            <div id="navbar-collapse-1" class="navbar-collapse collapse">
            	<ul class="nav navbar-nav">
                	<li class="<?php echo $homeCl; ?>"><?php echo $html->link(__('Home'),'/');?></li>
                    
                    <li class="<?php echo $listingCl; ?>"><?php echo $html->link(__('Listings'),'/listings');?></li>
                    <?php
					if($session->read("Auth.User.id") && (cr('ListingConfig.listing_add_only_by_editor') != 1 || $session->read('Auth.User.is_editor') == 1)) 
					{?><li class="<?php echo $listingAddCl; ?>"><?php
							echo $html->link(__('Add Listing'),'/listings/add');?>	</li><?php
					}
				?>
                    	<?php if(cr("DealConfig.enable_deals")) { ?>
					<li class="<?php echo $offerCl; ?>">
						<?php echo $html->link(__('Deals'),'/deals/deals/index/');?>
					</li>
				<?php } ?>
				
				<?php if(cr("EventConfig.enable_events")) { ?>
					<li class="<?php echo $eventCl; ?>">
						<?php echo $html->link(__('Events'),'/events/events/index');?>
					</li>
				<?php } ?>
                    <li class="<?php echo $userCl; ?>"><?php echo $html->link(__('Users'),'/users');?></li>
                    <li class="<?php echo $advSearchCl; ?>"><?php echo $html->link(__('Search'),'/listings/advancedSearch');?></li>
                </ul>
            </div>
            <div class="nav_right">
            <?php if(@$session->read('Auth.User'))
			{?>
		
            <div class="sign_in">
                    <a href="#" class="sign_btn_1"><?php echo __("My Account");?><span class="caret"></span></a>
                    <div class="sign_up_box">
                    <?php 
                echo $this->element('loginBox');
            ?>
                        
                    </div>
                </div>
			<?php }else{?>
			

            	<?php echo $html->link(__('Register'),'/users/register');?>
                <div class="sign_in">
                	<a href="#" class="sign_btn_1">Sign in<span class="caret"></span></a>
                    <div class="sign_up_box">
                    <?php 
				echo $this->element('loginBox');
			?>
                    	
                    </div>
                </div>
                			<?php }?>

            </div>
        </div>
    </div>   
